/*
 * Copyright (c) Huawei Technologies Co.,Ltd. 2023. All rights reserved.
 */
package org.opengauss.intercept;

import org.apache.ibatis.plugin.Interceptor;
import org.apache.ibatis.plugin.Intercepts;
import org.apache.ibatis.plugin.Invocation;
import org.apache.ibatis.plugin.Plugin;
import org.apache.ibatis.plugin.Signature;
import org.apache.ibatis.session.ResultContext;
import org.apache.ibatis.session.ResultHandler;

/**
 * Title: the StatementIntercept class.
 * <p>
 * Description:
 *
 * @author justbk
 * @version [Tools 0.0.1, 2023/7/24]
 * @since 2023/7/24
 */
@Intercepts(value = {
        @Signature(type= ResultHandler.class, method = "handleResult", args = {ResultContext.class})
})
public class ResultIntercept implements Interceptor {
    @Override
    public Object intercept(final Invocation invocation) throws Throwable {
        return DataRecordFactory.getResultRecord().doRecord(invocation);
    }
    
    @Override
    public Object plugin(final Object target) {
        return Plugin.wrap(target, this);
    }
}
